import { EntitySchema } from 'typeorm'
export const User = new EntitySchema({
  name: 'User',
  columns: {
    id: {
      primary: true,
      type: 'int',
      generated: true
    },
    // 姓名
    name: {
      type: 'varchar'
    },
    // 1男，2女
    sex: {
      type: 'int'
    },
    // 时间戳 s
    birth: {
      type: 'varchar',
      nullable: true
    },
    // 联系方式
    phone: {
      type: 'varchar'
    },
    // 等级门店
    address: {
      type: 'varchar'
    },

    // 时间戳 s
    createtime: {
      type: 'varchar'
    },
    // 时间戳 s
    updatetime: {
      type: 'varchar'
    },
    // 状态 1启用 0被删除
    status: {
      type: 'varchar'
    }
  },
  relations: {
    frequency: {
      target: 'Frequency',
      type: 'one-to-many',
      inverseSide: 'user',
      joinColumn: true
    },
    message: {
      target: 'Message',
      type: 'one-to-many',
      inverseSide: 'user',
      joinColumn: true
    }
  }
})
